﻿@model News.CYT369.Com.Domains.Document
@{ 
    var editor = ViewBag.Editor as News.CYT369.Com.Domains.Identity.SysUser;
    if (Model != null)
    {
        ViewData["Title"] = $"{Model.Title} - {News.CYT369.Com.Domains.SystemSettingService.Instance.SystemName}";
    }
}
@section styles{
    <link href="~/font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet" />
    <link href="~/css/articles-detail.css" rel="stylesheet" />
}
@section scripts{
    <script src="~/js/article-detail.js"></script>
    @if (Model != null)
    {
        var url = Url.Content("~/Articles/Viewed");
        var json = Base64.ObjectToBase64(new { DocID = this.Model.Id });

        <script type="text/javascript">
            function ReportReadStatus() { $.ajax({ method: "POST", url: "@url", data: { ID: @this.Model.Id, args:' @json' }, success: function (e) { console.log(e); } }); }
            setTimeout(ReportReadStatus, @News.CYT369.Com.Domains.SystemSettingService.Instance.ReportReadStatusTime);
        </script>
    }
}
<div class="panel articles-detail">
    <div class="article-body">
        <div class="title" title="@Model.Title">@Model.Title</div>
        @if (Model.DocExt != null)
        {
            if (!string.IsNullOrEmpty(Model.DocExt.SubHead))
            {
                <div class="sub-head">@Model.DocExt.SubHead</div>
            }
        }
        <div class="labels">
            <div>
                @if (editor != null)
                {
                    if (!string.IsNullOrEmpty(editor.HeaderUrl))
                    {
                        <img src="@editor.HeaderUrl" class="editor-icon2" />
                        <span class="label">@Model.EditorName</span>
                    }
                    else if (!string.IsNullOrEmpty(editor.Avatar))
                    {
                        <img src="@editor.Avatar" class="editor-icon2" />
                        <span class="label">@Model.EditorName</span>
                    }
                    else if (!string.IsNullOrEmpty(Model.EditorName))
                    {
                        <div class="editor-icon">@Model.EditorName.Substring(0, 1).ToUpper()</div>
                        <span class="label">@Model.EditorName</span>
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(Model.EditorName))
                    {
                        <div class="editor-icon">@Model.EditorName.Substring(0, 1).ToUpper()</div>
                        <span class="label">@Model.EditorName</span>
                    }
                }
                @if (!string.IsNullOrEmpty(Model.Author))
                {
                    <span class="label">@Model.Author</span>
                }
                @if (Model.PublishTime.HasValue)
                {
                    <span class="label">@Model.PublishTime.Value.ToString("yyyy年M月d日")</span>
                }

                @if (Model.TargetURL != null)
                {
                    if (Model.TargetURL.StartsWith("http", StringComparison.OrdinalIgnoreCase) == false && Model.TargetURL.StartsWith("https", StringComparison.OrdinalIgnoreCase) == false)
                    {
                        if (Model.TargetURL.Length > 30)
                        {
                            <span class="label">来源：@Model.TargetURL.Substring(0, 30)</span>
                        }
                        else
                        {
                            <span class="label">来源：@Model.TargetURL</span>
                        }
                    }
                }
            </div>
            <div>
                <span class="label"><i class="fa fa-eye" style="margin-right:5px"></i>@Model.Read</span>
                <a href="javascript:void()" class="label favorite"><i class="fa fa-heart-o" style="margin-right:5px"></i>收藏</a>
            </div>
        </div>
        <div class="summary">@Model.Summary</div>
        @if (Model.DocExt != null)
        {
            <div class="body-content">
                @Html.Raw(Model.DocExt.DocContent)
            </div>
        }
        <div class="clames">免责声明：本文来自内容创作者，不代表本网站的观点和立场。</div>
        @*<div>赞 & 收藏 & 评论</div>*@
        <div class="article-bottom">
            <div class="great-fav-shares">
                <div>
                    <div class="btn great-btn"><i class="fa fa-group"></i>赞</div>
                    <div class="btn fav-btn"><i class="fa fa-facebook-official"></i>收藏</div>
                </div>
                <div class="share-btns">
                    <div class="sbtn wechat"></div>
                    <div class="sbtn qq"></div>
                    <div class="sbtn qzone"></div>
                    <div class="sbtn sina"></div>
                </div>
            </div>
            @if (Model.CanComment)
            {
                <form action="~/Articles/DoComments" method="post" class="comment-input" target="_blank" onsubmit="return CheckComment(this)">
                    <div class="comment-title">
                        <div><span class="info-t">写评论</span><span class="info-s">文明上网理性发言，请遵守<a href="#">内容评论服务协议</a></span></div>
                        <div class="count-c">0条评论</div>
                    </div>
                    <textarea name="comment" class="comment-text min-scrollbar" placeholder="说两句吧"></textarea>
                    <div class="submit-panel">
                        <input name="docId" type="hidden" value="@Base64.ObjectToBase64(new { DocID = Model.Id })" />
                        <input type="submit" class="submit-btn" value="提 交" />
                    </div>
                </form>
                <div class="comments">
                    <div class="no-comment">这里还没有任何评论，期待你的声音</div>
                </div>
            }
        </div>
    </div>
</div>
